import 'bizmodel.dart';

class InternalData extends Object{
   List <PartsOrder> listOfPartsOrder;
   List <LendingOrder> listOfLendingOrder;
   List <MROrder>  listOfMROrder;
   List <PartsOrder> listOfExchangeOrder;

  InternalData () {
    listOfPartsOrder = new List();
    listOfLendingOrder = new List();
    listOfMROrder = new List();

    listOfPartsOrder..add(new PartsOrder(
        "po_1",
        "树根官方旗舰店",
        "交易成功",
        false,
        new List()
          ..add(new GoodsItem(
              "goods_1",
              "https://tse2-mm.cn.bing.net/th?id=OIP.9fbjvGvOb0_Y17G9zvX5zQHaF-&w=259&h=209&c=7&o=5&dpr=2&pid=1.7",
              "液压传动两用油",
              100.00,
              3))..add(new GoodsItem(
            "goods_2",
            "https://tse3-mm.cn.bing.net/th?id=OIP.rAcCqlreONxSI_WnTt8J1gHaFU&w=262&h=186&c=7&o=5&dpr=2&pid=1.7",
            "SY5418THB 490C-8S",
            100.00,
            3))..add(new GoodsItem(
            "goods_3",
            "https://tse2-mm.cn.bing.net/th?id=OIP.BkdeAlgXW55Nn0qBAlA0dAHaF7&w=248&h=198&c=7&o=5&dpr=2&pid=1.7",
            "SY5418THB 490C-8S",
            100.00,
            3))))..add(new PartsOrder(
        "po_2",
        "江苏江阴起重机配件厂",
        "交易成功",
        false,
        new List()
          ..add(new GoodsItem(
              "goods_4",
              "http://images.mfcad.com/tuzhi/2016/12/02/1480666667242.png@!water",
              "起重机车轮组",
              100.00,
              3))..add(new GoodsItem("goods_5",
            "http://img.buy-hk.org/upload/sag7nhy0ehg7/2013-10/201310261701221485.jpg",
            "起重机车轮组", 100.00, 3))))
      ..add(new PartsOrder(
        "po_3", "华达机械配件厂", "交易成功", false,
          new List()
      ..add(new GoodsItem("goods_6",
          "http://www.dgcdwj.com/uploadfile/image/20180709/20180709141950_1129348254.jpg",
          "650T-3600T料筒", 100.00, 3))..add(new GoodsItem("goods_61",
          "http://www.dgcdwj.com/uploadfile/image/20180709/20180709142151_688562973.jpg",
          "力劲88T料壶", 100.00, 3))..add(new GoodsItem(
          "goods_62", "http://file.youboy.com/a/116/53/69/9/647819.jpg",
          "镁合金钨钢嘴头", 100.00, 3))..add(new GoodsItem("goods_63",
          "http://www.dgcdwj.com/uploadfile/image/20180709/20180709143159_696660379.jpg",
          "纳米陶瓷柱塞头", 100.00, 3))))
      ..add(new PartsOrder(
        "po_4", "树根官方旗舰店", "交易成功", false, new List()
      ..add(new GoodsItem(
          "goods_7", "http://file0.youboy.com/a/36/98/23/6/1299516.jpg?360*300",
          "力劲压铸机配件88T锤头连柄", 100.00, 3))))..add(new PartsOrder(
        "po_5", "树根官方旗舰店", "交易成功", false, new List()
      ..add(new GoodsItem("goods_8",
          "https://cn.bing.com/th?id=OIP.vOfDm6jHvjJAvlv2rbYwvAAAAA&pid=Api&rs=1",
          "四连杆喷雾剂", 100.00, 3))))..add(new PartsOrder("po_6", "树根官方旗舰店", "交易成功",
        false, new List()
          ..add(new GoodsItem("goods_9",
              "http://alipic.files.mozhan.com/mozhan/20180319/d24b91b6bf9e54381f91a1db1021d3d1.jpg?x-oss-process=image/resize,limit_0,m_fill,w_450,h_338",
              "电炉", 100.00, 3))));

    listOfLendingOrder..add(new LendingOrder(
        "lo_1",
        "SY395H挖掘机租赁合同",
        "https://product.sanygroup.com/images/201611/goods_img/639_G_1479200569289.jpg",
        "三湘银行",
        4500000,
        "已交付"))..add(new LendingOrder(
        "lo_2",
        "SY65W轮胎式液压挖掘机",
        "https://product.sanygroup.com/images/201607/goods_img/131_G_1469609438189.jpg",
        "三湘银行",
        4500000,
        "已交付"))..add(new LendingOrder(
        "lo_3",
        "SYL956H轮式装载机租赁合同",
        "https://product.sanygroup.com/images/201607/goods_img/137_G_1469607135593.jpg",
        "三湘银行",
        4500000,
        "已交付"))..add(new LendingOrder(
        "lo_4",
        "V8系列混凝土泵车SYM5163THBDS 21租赁合同",
        "https://product.sanygroup.com/images/201607/goods_img/388_G_1469611436527.jpg",
        "三湘银行",
        4500000,
        "已交付"))..add(new LendingOrder(
        "lo_5",
        "SYM5333THB 470C-8租赁合同",
        "https://product.sanygroup.com/images/201811/goods_img/789_G_1541493876573.jpg",
        "三湘银行",
        4500000,
        "已交付"))..add(new LendingOrder("lo_6", "C系列搅拌车SY306C-6Y(V)租赁合同",
        "https://product.sanygroup.com/images/201607/goods_img/471_G_1469607733176.jpg",
        "三湘银行", 4500000, "已交付"))..add(new LendingOrder(
        "lo_7", "C系列搅拌车SY306C-6Y(V)租赁合同",
        "https://product.sanygroup.com/images/201607/goods_img/471_G_1469607733176.jpg",
        "浙江商业银行", 4500000, "已交付"))..add(new LendingOrder(
        "lo_8", "C系列搅拌车SY408C-8(IV)Y租赁合同",
        "https://product.sanygroup.com/images/201607/goods_img/544_G_1469607097928.jpg",
        "三湘银行", 4500000, "已交付"))..add(new LendingOrder("lo_9", "HQC4250T租赁合同",
        "https://product.sanygroup.com/images/201806/goods_img/756_G_1529051406815.jpg",
        "三湘银行", 4500000, "已交付"))..add(new LendingOrder(
        "lo_10", "SAC1300T全地面汽车起重机租赁合同",
        "https://product.sanygroup.com/images/201902/1550734595964393669.jpg",
        "浙江商业银行", 4500000, "已交付"))..add(new LendingOrder(
        "lo_11", "SAC2200T全地面汽车起重机租赁合同",
        "https://product.sanygroup.com/images/201902/1550736077811908808.jpg",
        "三湘银行", 4500000, "已交付"))..add(new LendingOrder("lo_12", "HQC4250T租赁合同",
        "https://product.sanygroup.com/images/201806/goods_img/756_G_1529051406815.jpg",
        "浙江商业银行", 4500000, "已交付"))..add(new LendingOrder(
        "lo_13", "SAC2200T全地面汽车起重机租赁合同",
        "https://product.sanygroup.com/images/201902/1550736077811908808.jpg",
        "三湘银行", 4500000, "已交付"))..add(new LendingOrder(
        "lo_14", "SSC1020C风电专用起重机租赁合同",
        "https://product.sanygroup.com/images/201607/goods_img/78_G_1469604830107.jpg",
        "浙江商业银行", 4500000, "已交付"))..add(new LendingOrder(
        "lo_15", "SAC1300T全地面汽车起重机租赁合同",
        "https://product.sanygroup.com/images/201902/1550734595964393669.jpg",
        "三湘银行", 4500000, "已交付"));

    listOfMROrder..add(new MROrder(
        "mro_1",
        "液压系统修理",
        "刘克鸿",
        "https://cn.bing.com/th?id=OIP.5s15IU2cPDGg7-YxDfqDyQAAAA&pid=Api&rs=1",
        EngineerLevel.STAR5,
        RepairStatus.DELIVERED,
        AppraiseStatus.BOTH))..add(new MROrder(
        "mro_2",
        "挖掘机无法启动",
        "张三强",
        "http://img.135q.com/2015-03/18/14266441910001.jpg",
        EngineerLevel.STAR3,
        RepairStatus.REPAIRING,
        AppraiseStatus.NONE))..add(new MROrder(
        "mro_3",
        "伸中臂黑烟",
        "张三强",
        "http://img.135q.com/2015-03/18/14266441910001.jpg",
        EngineerLevel.STAR3,
        RepairStatus.DELIVERED,
        AppraiseStatus.ENGINEER))..add(new MROrder(
        "mro_4",
        "电脑版维修",
        "刘克鸿",
        "https://cn.bing.com/th?id=OIP.5s15IU2cPDGg7-YxDfqDyQAAAA&pid=Api&rs=1",
        EngineerLevel.STAR5,
        RepairStatus.REPAIRING,
        AppraiseStatus.NONE))..add(new MROrder(
        "mro_5",
        "大泵异响",
        "刘大俊",
        "https://www.scooter-iran.ir/Files/Image/8.png",
        EngineerLevel.STAR5,
        RepairStatus.DELIVERED,
        AppraiseStatus.OWNER))..add(new MROrder(
        "mro_6",
        "行走跑偏",
        "李黎名",
        "http://www.jituwang.com/uploads/allimg/150206/259502-15020619462024.jpg",
        EngineerLevel.STAR5,
        RepairStatus.REPAIRING,
        AppraiseStatus.NONE))..add(new MROrder(
        "mro_7",
        "注塑机线路,油路检修",
        "张文政",
        "http://pic19.nipic.com/20120303/4010467_101847632387_2.jpg",
        EngineerLevel.STAR5,
        RepairStatus.DELIVERED,
        AppraiseStatus.BOTH))..add(new MROrder(
        "mro_8",
        "注塑机电脑维修",
        "刘师傅",
        "http://bpic.588ku.com/element_pic/18/02/08/2b84e02cf7fbc81e2e868c6d606c4413.jpg",
        EngineerLevel.STAR4,
        RepairStatus.DELIVERED,
        AppraiseStatus.ENGINEER))..add(new MROrder(
        "mro_9",
        "注塑机变量泵维修",
        "贺师傅",
        "https://cn.bing.com/th?id=OIP.f0VLlR7gG4yDGw9vDi_WugHaHa&pid=Api&rs=1",
        EngineerLevel.STAR5,
        RepairStatus.REPAIRING,
        AppraiseStatus.NONE))..add(new MROrder(
        "mro_10",
        "注塑机伺服系统维修",
        "刘师傅",
        "http://bpic.588ku.com/element_pic/16/11/10/ee8ce2f6c94aa6c97c2d408c8bfd2f89.jpg!/fw/208/quality/90/unsharp/true/compress/true",
        EngineerLevel.STAR4,
        RepairStatus.DELIVERED,
        AppraiseStatus.BOTH))..add(new MROrder(
        "mro_11",
        "注塑机机铰大修",
        "毛毛雨",
        "http://images.17173.com/2012/fn/2012/03/19/20120319004630158.jpg",
        EngineerLevel.STAR3,
        RepairStatus.REPAIRING,
        AppraiseStatus.NONE));


    listOfPartsOrder..add(new PartsOrder(
        "po_100",
        "山东蓝祥设备交换有限公司",
        "交易成功",
        true,
        new List()
          ..add(new GoodsItem(
              "goods_100",
              "https://product.sanygroup.com/images/201703/goods_img/55_G_1489647508507.jpg",
              "5吨随车吊SPS12500三一随车起重机",
              100.00,
              1))))..add(new PartsOrder(
        "po_101",
        "江苏江阴作业设备修配厂",
        "交易成功",true,
        new List()
          ..add(new GoodsItem(
              "goods_101",
              "https://product.sanygroup.com/images/201803/goods_img/736_G_1520937323967.jpg",
              "剪叉式高空作业车",
              100.00,
              1))
    ))..add(new PartsOrder("po_102", "华达机械配件厂", "交易成功", true, List()
      ..add(new GoodsItem("goods_102",
          "https://product.sanygroup.com/images/201609/1475047989749066735.jpg",
          "SCC550TB伸缩臂履带起重机", 100.00, 3))))..add(new PartsOrder(
        "po_103", "树根官方旗舰店", "交易成功", true,new List()
      ..add(new GoodsItem("goods_103",
          "https://product.sanygroup.com/images/201810/goods_img/777_G_1539854315182.jpg",
          "SCC550A履带起重机", 100.00, 3))))..add(new PartsOrder(
        "po_104", "树根官方旗舰店", "交易成功", true,new List()
      ..add(new GoodsItem("goods_104",
          "https://product.sanygroup.com/images/201812/goods_img/820_G_1545121924995.jpg",
          "STR260H隧道掘进机", 100.00, 3))))..add(new PartsOrder(
        "po_105", "树根官方旗舰店", "交易成功", true,new List()
      ..add(new GoodsItem("goods_105",
          "https://product.sanygroup.com/images/201709/goods_img/537_G_1505285656033.jpg",
          "SR360R-C10系列旋挖钻机", 100.00, 3))));
  }

}


class TestData extends Object{
  static final  InternalData internalData = new InternalData();

  static getGoodsById(String id){
    print("here");
    print (internalData.listOfPartsOrder.length);
    for(var i = 0; i<internalData.listOfPartsOrder.length; i++){
      PartsOrder po = internalData.listOfPartsOrder[i];
      print(po.id);
      for(var j=0; j<po.goods.length; j++){
        GoodsItem gi = po.goods[j];
        print("\t${gi.id}");
        if(gi.id == id){
          return gi;
        }
      }
    }
    return null;
  }

  static getExchangeById(String id){
    print("here");
    print (internalData.listOfExchangeOrder.length);
    for(var i = 0; i<internalData.listOfExchangeOrder.length; i++){
      PartsOrder po = internalData.listOfExchangeOrder[i];
      print(po.id);
      for(var j=0; j<po.goods.length; j++){
        GoodsItem gi = po.goods[j];
        print("\t${gi.id}");
        if(gi.id == id){
          return gi;
        }
      }
    }
    return null;
  }


  static getLendingOrderById(String id){
    for(var i = 0; i<internalData.listOfLendingOrder.length; i++){
      LendingOrder order = internalData.listOfLendingOrder[i];
      if(order.id == id){
        return order;
      }
    }
    return null;
  }


  static getMROrderById(String id){
    for(var i = 0; i<internalData.listOfMROrder.length; i++){
      MROrder order = internalData.listOfMROrder[i];
      if(order.id == id){
        return order;
      }
    }
    return null;
  }

}